package com.sc.nft.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sc.nft.entity.DaoSchoolChildMaterial;
import com.sc.nft.entity.dto.DaoSchoolChildMaterialPageAdminDTO;
import com.sc.nft.entity.dto.DaoSchoolChildMaterialUpdateSortAdminDTO;
import com.sc.nft.entity.dto.DaoSchoolHomeArticleListDTO;
import com.sc.nft.entity.dto.DaoSchoolMaterialNotChildIdPageListDTO;
import com.sc.nft.entity.vo.DaoSchoolChildMaterialNotPageAdminVO;
import com.sc.nft.entity.vo.DaoSchoolChildMaterialPageAdminVO;
import com.sc.nft.entity.vo.DaoSchoolChildMaterialPageVO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 素材表与子集关联表(DaoSchoolChildMaterial)表数据库访问层
 *
 * @author makejava
 * @since 2023-03-15 18:07:44
 */
public interface DaoSchoolChildMaterialMapper extends BaseMapper<DaoSchoolChildMaterial> {

    /**
     * 获取关联的所有素材
     *
     * @param pageRequest
     * @return
     */
    Page<DaoSchoolChildMaterialPageAdminVO> pageAdmin(Page page, @Param("data") DaoSchoolChildMaterialPageAdminDTO pageRequest);

    /**
     * 获取没有被某个子集选中的文章
     *
     * @param dto
     * @return
     */
    Page<DaoSchoolChildMaterialNotPageAdminVO> selectByNotChildIdPageList(Page page, @Param("data") DaoSchoolMaterialNotChildIdPageListDTO dto);

    /**
     * 素材关联新增
     *
     * @param info
     * @return
     */
    Integer saveAdmin(@Param("list") List<DaoSchoolChildMaterial> info);

    /**
     * 获取子集下的素材
     *
     * @param dto
     * @return
     */
    Page<DaoSchoolChildMaterialPageVO> getChildMaterialList(Page page, @Param("data") DaoSchoolHomeArticleListDTO dto, @Param("daoId") Long daoId);

    /**
     * 修改排序
     *
     * @param dto
     * @return
     */
    Boolean updateSortById(@Param("data") DaoSchoolChildMaterialUpdateSortAdminDTO dto);

}
